#!/bin/bash

curdir=$(cd "$(dirname "$0")"; pwd)

#compile in docker.
container=(amd64_debian9 arm64_debian9 loongarch64_loongnix loongson3_debian9)
i=0
while [[ i -lt ${#container[@]} ]]; do

	echo "building in container: ${container[i]} ..."

	docker start ${container[i]}
	docker exec -i ${container[i]} bash -c "cd $curdir && ./build.sh"
	if [ ${container[i]} = "amd64_debian9" ]; then
		docker exec -i ${container[i]} bash -c "cd $curdir && ./build_android_arm.sh"
		docker exec -i ${container[i]} bash -c "cd $curdir && ./build_android_aarch64.sh"		
	fi
	docker stop ${container[i]}

let i++
done

#compile harmony in vm inner.
./build_harmony_arm.sh
./build_harmony_aarch64.sh

